//
//  PopupView.m
//  WuJieLive
//
//  Created by 张瀚坤 on 2017/11/3.
//  Copyright © 2017年 zhk. All rights reserved.
//

#import "PopupView.h"

@implementation PopupView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupView];
    }
    return self;
}

- (void)setupView
{
    self.bgImage = [[UIImageView alloc]init];
    [self addSubview:self.bgImage];
    self.bgImage.image = Image(@"box_二维码");
    [self.bgImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.centerY.equalTo(self);
        make.height.offset(420);
    }];
    
    self.headerImage = [[UIImageView alloc]init];
    [self.bgImage addSubview:self.headerImage];
    [self.headerImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.bgImage);
        make.top.offset(-30);
        make.size.mas_offset(CGSizeMake(60, 60));
    }];
    self.headerImage.layer.masksToBounds = YES;
    self.headerImage.layer.cornerRadius = 30;
    self.headerImage.layer.borderColor = [UIColor whiteColor].CGColor;
    self.headerImage.layer.borderWidth = 1;
    self.headerImage.backgroundColor = [UIColor redColor];
    
    self.textLabel = [[UILabel alloc]init];
    [self.bgImage addSubview:self.textLabel];
    self.textLabel.numberOfLines = 0;
    [self.textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.bgImage);
        make.top.offset(50);
        make.width.offset(kScreenWidth - 100);
        make.height.offset(60);
    }];
    self.textLabel.font = FontSize(15);
    self.textLabel.textAlignment = NSTextAlignmentCenter;
    self.textLabel.textColor = TextLessImportColor;
    
    self.QRcodeImage = [[UIImageView alloc]init];
    [self.bgImage addSubview:self.QRcodeImage];
    [self.QRcodeImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(40);
        make.right.offset(-40);
        make.centerX.equalTo(self.QRcodeImage);
        make.top.equalTo(self.textLabel.mas_bottom).offset(30);
        make.bottom.offset(-50);
    }];
    
    self.moreBtn = [[UIButton alloc]init];
    [self.bgImage addSubview:self.moreBtn];
    [self.moreBtn setTitleColor:TextLessImportColor forState:(UIControlStateNormal)];
    [self.moreBtn setTitle:@"更多分享方式" forState:(UIControlStateNormal)];
    [self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.bgImage);
        make.top.equalTo(self.QRcodeImage.mas_bottom).offset(20);
        make.size.mas_offset(CGSizeMake(90, 25));
    }];
    self.moreBtn.titleLabel.font = FontSize(12);
    
}




@end
